package com.thread;

public class MyThread implements Runnable{
    public void run(){
        cross();
    }
    int count = 0;
    public synchronized void cross(){
        try{
            Thread.sleep(5000);
        }catch(Exception e){
            e.printStackTrace();
        }
        count++;
        System.out.println(Thread.currentThread().getName() + "已经通过隧道" +
                "，TA是第" + count + "通过的！");
    }
}